<template>
  <el-card>
    <el-table :data="rightsList" stripe style="width: 100%" border>
      <el-table-column type="index" width="50" />
      <el-table-column prop="authName" label="权限名称" />
      <el-table-column prop="path" label="路径" />
      <el-table-column prop="level" label="权限等级">
        <template #default="{ row }">
          <el-tag v-if="row.level === '0'" type="">一级</el-tag>
          <el-tag v-else-if="row.level === '1'" type="success">二级</el-tag>
          <el-tag v-else type="warning">三级</el-tag>
        </template>
      </el-table-column>
    </el-table>
  </el-card>
</template>

<script setup>
import { ref } from 'vue'
import { getRights } from '@/api/rights'
// 权限列表
const rightsList = ref([])
// 初始化权限列表
const initGetRightsList = async () => {
  const res = await getRights('list')
  // console.log(res)
  rightsList.value = res
}
initGetRightsList()
</script>

<style lang="scss" scoped></style>
